package com.bee.bootstrap.system.controller;

import com.bee.bootstrap.system.service.ISmsVerifyService;
import com.bee.common.core.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
@Api(value = "/sms", description = "短信资源")
public class SmsController {

    @Autowired
    private ISmsVerifyService smsVerifyServiceImpl;

    @PostMapping("/code")
    @ApiOperation(value="获取手机验证码", notes="根据手机号码获取短信验证码")
    public Result phoneAucthCode(@RequestParam(required = false, defaultValue = "") @NotBlank(message = "手机号码不能为空") String phone,
                                 @RequestParam(required = false, defaultValue = "") @NotBlank(message = "短信类型不能为空") String type){
        return smsVerifyServiceImpl.saveSendSms(phone,type);
    }

}
